#!/usr/bin/env python3
# -*- coding:utf-8 -*-
####################################################################################################
# File: cmd.py                                                                                     #
# Created Date: Sunday, August 15th 2021, 12:45:10 am                                              #
# Author: Zongliang Hou                                                                            #
# E-mail: EnderZ@sjtu.edu.cn                                                                       #
# Copyright (c) 2021 Lei Lab                                                                       #
####################################################################################################


import argparse
import sys
sys.path.append("/Users/ender/Code_repo/rosalind-brush-questions")
from utils import read_seqfile, write_seqfile


parser = argparse.ArgumentParser()
parser.add_argument('-s', '--sequence', type=str, help='DNA sequence file')
parser.add_argument('-o', '--output', type=str, help='Complementary sequence file')
args = parser.parse_args()

seq = read_seqfile(args.sequence)
# Replace A->T and T->A
seq = seq.replace('A', 'N').replace('T', 'A').replace('N', 'T')
# Replace C->G and G->C
seq = seq.replace('C', 'N').replace('G', 'C').replace('N', 'G')
# Reversed
seq = seq[::-1]
write_seqfile(seq, args.output)
print(seq)